package com.qf.purchase.service;

import com.github.pagehelper.PageInfo;
import com.qf.purchase.dao.CityDao;
import com.qf.purchase.po.City;
import com.qf.purchase.service.CityService;
import com.qf.purchase.utils.Region;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Copyright (C),2022
 * FileName: CityServiceImpl
 * Author: ding
 * Date:2022/5/7 10:53
 */
@Service
public class CityServiceImpl implements CityService {
    @Resource
    CityDao cityDao;
    @Override
    public boolean addCity(City city) {
        return cityDao.addCity(city)>0;
    }

    @Override
    public boolean updateCity(City city) {
        return cityDao.updateCity(city)>0;
    }

    @Override
    public PageInfo<Region> getAllCityByPage(Map map) {
        PageInfo<Region> pageInfo=new PageInfo<Region>(cityDao.getAllCityByPage(map));
        return pageInfo;
    }

    @Override
    public City getCityById(int id) {
        return cityDao.getCityById(id);
    }
}
